<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>数据绑定</title>
    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
    <style>
        #one{
            width: 200px;
            height: 300px;
            background-color: brown;
        }
        #two{
            width: 100px;
            height: 100px;
            background-color: black;

        }
    </style>
</head>
<body>
<div id="root">

        <div @click.stop="oneEvent" id="one">
            <div @click.stop.prevent="twoEvent" id="two">

            </div>
        </div>
<!--键盘事件修饰符-->
    <input style="background-color: coral;width: 500px" @keydown.left.right.tap="keyDownEvent"/>
<!--    鼠标事件修饰符-->
    <button @mousedown.middle="mouseEvent">点击</button>
<fieldset>
    <legend>
        <h2>双向数据绑定</h2>
    </legend>
    <input type="text" v-model="input">
    <p>{{input}}</p>
    <input type="text" v-model="name">
    <input type="password" v-model="password">
    <button @click="tijiao">提交</button>
</fieldset>

</div>
</body>
</html>
<script>
    new Vue({
        el:"#root",
        data:{
            input:"李白",
            name:"",
            password:"",
        },
        methods:{
            oneEvent(){
                console.log("one");
            },
            twoEvent(e){
                console.log("two");
            },
            keyDownEvent(e){
                console.log("啦");
            },
            mouseEvent(){
                console.log("鼠标点击了")
            },
            tijiao(){
                console.log(this.name,this.password)
            }
        }
    })
</script>